name = "foo"
required-features = ["a"]
"#)
- .file("src/main.rs", "fn main() {}");
+ .file("src/main.rs", r#"
+ extern crate foo;
+
+ #[cfg(feature = "a")]
+ fn test() {
+ foo::foo();
+ }
+
+ fn main() {}
+ "#)
+ .file("src/lib.rs", r#"
+ #[cfg(feature = "a")]
+ pub fn foo() {}
+ "#);
+ p.build();
- assert_that(p.cargo_process("build"),
+ assert_that(p.cargo("build"),
execs().with_status(0));
assert_that(&p.bin("foo"), existing_file());
- assert_that(p.cargo_process("build").arg("--no-default-features"),
+ assert_that(p.cargo("build").arg("--no-default-features"),
execs().with_status(0));
- assert_that(&p.bin("foo"), not(existing_file()));
- assert_that(p.cargo_process("build").arg("--bin=foo"),
+ assert_that(p.cargo("build").arg("--bin=foo"),
execs().with_status(0));
assert_that(&p.bin("foo"), existing_file());
- assert_that(p.cargo_process("build").arg("--bin=foo").arg("--no-default-features"),
+ assert_that(p.cargo("build").arg("--bin=foo").arg("--no-default-features"),
execs().with_status(101).with_stderr("\
error: target `foo` requires the features: `a`
Consider enabling them by passing e.g. `--features=\"a\"`
"));
- assert_that(&p.bin("foo"), not(existing_file()));
}
#[test]
required-features = ["a"]
"#)
.file("src/main.rs", "fn main() {}");
+ p.build();
- assert_that(p.cargo_process("build").arg("--features").arg("a"),
+ assert_that(p.cargo("build").arg("--features").arg("a"),
execs().with_status(0));
assert_that(&p.bin("foo"), existing_file());
}
"#)
.file("src/foo_1.rs", "fn main() {}")
.file("src/foo_2.rs", "fn main() {}");
+ p.build();
- assert_that(p.cargo_process("build"),
+ assert_that(p.cargo("build"),
execs().with_status(0));
assert_that(&p.bin("foo_1"), not(existing_file()));
assert_that(&p.bin("foo_2"), existing_file());
- assert_that(p.cargo_process("build").arg("--features").arg("c"),
+ assert_that(p.cargo("build").arg("--features").arg("c"),
execs().with_status(0));
assert_that(&p.bin("foo_1"), existing_file());
assert_that(&p.bin("foo_2"), existing_file());
- assert_that(p.cargo_process("build").arg("--no-default-features"),
+ assert_that(p.cargo("build").arg("--no-default-features"),
execs().with_status(0));
-
- assert_that(&p.bin("foo_1"), not(existing_file()));
- assert_that(&p.bin("foo_2"), not(existing_file()));
}
#[test]
required-features = ["a"]
"#)
.file("examples/foo.rs", "fn main() {}");
+ p.build();
- assert_that(p.cargo_process("build").arg("--example=foo"),
+ assert_that(p.cargo("build").arg("--example=foo"),
execs().with_status(0));
assert_that(&p.bin("examples/foo"), existing_file());
- assert_that(p.cargo_process("build").arg("--example=foo").arg("--no-default-features"),
+ assert_that(p.cargo("build").arg("--example=foo").arg("--no-default-features"),
execs().with_status(101).with_stderr("\
error: target `foo` requires the features: `a`
Consider enabling them by passing e.g. `--features=\"a\"`
"));
- assert_that(&p.bin("examples/foo"), not(existing_file()));
}
#[test]
required-features = ["a"]
"#)
.file("examples/foo.rs", "fn main() {}");
+ p.build();
- assert_that(p.cargo_process("build").arg("--example=foo").arg("--features").arg("a"),
+ assert_that(p.cargo("build").arg("--example=foo").arg("--features").arg("a"),
execs().with_status(0));
assert_that(&p.bin("examples/foo"), existing_file());
}
"#)
.file("examples/foo_1.rs", "fn main() {}")
.file("examples/foo_2.rs", "fn main() {}");
+ p.build();
- assert_that(p.cargo_process("build").arg("--example=foo_1"),
+ assert_that(p.cargo("build").arg("--example=foo_1"),
execs().with_status(101).with_stderr("\
error: target `foo_1` requires the features: `b`, `c`
Consider enabling them by passing e.g. `--features=\"b c\"`
assert_that(&p.bin("examples/foo_1"), not(existing_file()));
assert_that(&p.bin("examples/foo_2"), existing_file());
- assert_that(p.cargo_process("build").arg("--example=foo_1")
+ assert_that(p.cargo("build").arg("--example=foo_1")
.arg("--features").arg("c"),
execs().with_status(0));
assert_that(p.cargo("build").arg("--example=foo_2")
assert_that(&p.bin("examples/foo_1"), existing_file());
assert_that(&p.bin("examples/foo_2"), existing_file());
- assert_that(p.cargo_process("build").arg("--example=foo_1")
+ assert_that(p.cargo("build").arg("--example=foo_1")
.arg("--no-default-features"),
execs().with_status(101).with_stderr("\
error: target `foo_1` requires the features: `b`, `c`
error: target `foo_2` requires the features: `a`
Consider enabling them by passing e.g. `--features=\"a\"`
"));
-
- assert_that(&p.bin("examples/foo_1"), not(existing_file()));
- assert_that(&p.bin("examples/foo_2"), not(existing_file()));
}
#[test]
required-features = ["a"]
"#)
.file("tests/foo.rs", "#[test]\nfn test() {}");
+ p.build();
- assert_that(p.cargo_process("test"),
+ assert_that(p.cargo("test"),
execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
"));
- assert_that(p.cargo_process("test").arg("--no-default-features"),
+ assert_that(p.cargo("test").arg("--no-default-features"),
execs().with_status(0).with_stderr(format!("\
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"))
.with_stdout(""));
- assert_that(p.cargo_process("test").arg("--test=foo"),
+ assert_that(p.cargo("test").arg("--test=foo"),
execs().with_status(0).with_stderr(format!("\
-[COMPILING] foo v0.0.1 ({})
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]", p.url()))
+[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]"))
.with_stdout("
running 1 test
test test ... ok
"));
- assert_that(p.cargo_process("test").arg("--test=foo").arg("--no-default-features"),
+ assert_that(p.cargo("test").arg("--test=foo").arg("--no-default-features"),
execs().with_status(101).with_stderr("\
error: target `foo` requires the features: `a`
Consider enabling them by passing e.g. `--features=\"a\"`
required-features = ["a"]
"#)
.file("tests/foo.rs", "#[test]\nfn test() {}");
+ p.build();
- assert_that(p.cargo_process("test").arg("--features").arg("a"),
+ assert_that(p.cargo("test").arg("--features").arg("a"),
execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
"#)
.file("tests/foo_1.rs", "#[test]\nfn test() {}")
.file("tests/foo_2.rs", "#[test]\nfn test() {}");
+ p.build();
- assert_that(p.cargo_process("test"),
+ assert_that(p.cargo("test"),
execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
"));
- assert_that(p.cargo_process("test").arg("--features").arg("c"),
+ assert_that(p.cargo("test").arg("--features").arg("c"),
execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
"));
- assert_that(p.cargo_process("test").arg("--no-default-features"),
+ assert_that(p.cargo("test").arg("--no-default-features"),
execs().with_status(0).with_stderr(format!("\
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"))
.with_stdout(""));
#[bench]
fn bench(_: &mut test::Bencher) {
}"#);
+ p.build();
- assert_that(p.cargo_process("bench"),
+ assert_that(p.cargo("bench"),
execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] release [optimized] target(s) in [..]
"));
- assert_that(p.cargo_process("bench").arg("--no-default-features"),
+ assert_that(p.cargo("bench").arg("--no-default-features"),
execs().with_status(0).with_stderr(format!("\
[FINISHED] release [optimized] target(s) in [..]"))
.with_stdout(""));
- assert_that(p.cargo_process("bench").arg("--bench=foo"),
+ assert_that(p.cargo("bench").arg("--bench=foo"),
execs().with_status(0).with_stderr(format!("\
-[COMPILING] foo v0.0.1 ({})
[FINISHED] release [optimized] target(s) in [..]
-[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", p.url()))
+[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]"))
.with_stdout("
running 1 test
test bench ... bench: [..] 0 ns/iter (+/- 0)
"));
- assert_that(p.cargo_process("bench").arg("--bench=foo").arg("--no-default-features"),
+ assert_that(p.cargo("bench").arg("--bench=foo").arg("--no-default-features"),
execs().with_status(101).with_stderr("\
error: target `foo` requires the features: `a`
Consider enabling them by passing e.g. `--features=\"a\"`
#[bench]
fn bench(_: &mut test::Bencher) {
}"#);
+ p.build();
- assert_that(p.cargo_process("bench").arg("--features").arg("a"),
+ assert_that(p.cargo("bench").arg("--features").arg("a"),
execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] release [optimized] target(s) in [..]
#[bench]
fn bench(_: &mut test::Bencher) {
}"#);
+ p.build();
- assert_that(p.cargo_process("bench"),
+ assert_that(p.cargo("bench"),
execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] release [optimized] target(s) in [..]
"));
- assert_that(p.cargo_process("bench").arg("--features").arg("c"),
+ assert_that(p.cargo("bench").arg("--features").arg("c"),
execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] release [optimized] target(s) in [..]
"));
- assert_that(p.cargo_process("bench").arg("--no-default-features"),
+ assert_that(p.cargo("bench").arg("--no-default-features"),
execs().with_status(0).with_stderr(format!("\
[FINISHED] release [optimized] target(s) in [..]"))
.with_stdout(""));
"#)
.file("src/main.rs", "fn main() {}")
.file("examples/foo.rs", "fn main() {}");
+ p.build();
- assert_that(p.cargo_process("install"),
+ assert_that(p.cargo("install"),
execs().with_status(0));
assert_that(cargo_home(), has_installed_exe("foo"));
- assert_that(p.cargo_process("uninstall").arg("foo"),
+ assert_that(p.cargo("uninstall").arg("foo"),
execs().with_status(0));
- assert_that(p.cargo_process("install").arg("--no-default-features"),
+ assert_that(p.cargo("install").arg("--no-default-features"),
execs().with_status(101).with_stderr(format!("\
[INSTALLING] foo v0.0.1 ([..])
[FINISHED] release [optimized] target(s) in [..]
")));
assert_that(cargo_home(), not(has_installed_exe("foo")));
- assert_that(p.cargo_process("install").arg("--bin=foo"),
+ assert_that(p.cargo("install").arg("--bin=foo"),
execs().with_status(0));
assert_that(cargo_home(), has_installed_exe("foo"));
- assert_that(p.cargo_process("uninstall").arg("foo"),
+ assert_that(p.cargo("uninstall").arg("foo"),
execs().with_status(0));
- assert_that(p.cargo_process("install").arg("--bin=foo").arg("--no-default-features"),
+ assert_that(p.cargo("install").arg("--bin=foo").arg("--no-default-features"),
execs().with_status(101).with_stderr(format!("\
[INSTALLING] foo v0.0.1 ([..])
[ERROR] failed to compile `foo v0.0.1 ([..])`, intermediate artifacts can be found at \
")));
assert_that(cargo_home(), not(has_installed_exe("foo")));
- assert_that(p.cargo_process("install").arg("--example=foo"),
+ assert_that(p.cargo("install").arg("--example=foo"),
execs().with_status(0));
assert_that(cargo_home(), has_installed_exe("foo"));
- assert_that(p.cargo_process("uninstall").arg("foo"),
+ assert_that(p.cargo("uninstall").arg("foo"),
execs().with_status(0));
- assert_that(p.cargo_process("install").arg("--example=foo").arg("--no-default-features"),
+ assert_that(p.cargo("install").arg("--example=foo").arg("--no-default-features"),
execs().with_status(101).with_stderr(format!("\
[INSTALLING] foo v0.0.1 ([..])
[ERROR] failed to compile `foo v0.0.1 ([..])`, intermediate artifacts can be found at \
required-features = ["a"]
"#)
.file("src/main.rs", "fn main() {}");
+ p.build();
- assert_that(p.cargo_process("install").arg("--features").arg("a"),
+ assert_that(p.cargo("install").arg("--features").arg("a"),
execs().with_status(0));
assert_that(cargo_home(), has_installed_exe("foo"));
- assert_that(p.cargo_process("uninstall").arg("foo"),
+ assert_that(p.cargo("uninstall").arg("foo"),
execs().with_status(0));
}
"#)
.file("src/foo_1.rs", "fn main() {}")
.file("src/foo_2.rs", "fn main() {}");
+ p.build();
- assert_that(p.cargo_process("install"),
+ assert_that(p.cargo("install"),
execs().with_status(0));
assert_that(cargo_home(), not(has_installed_exe("foo_1")));
assert_that(cargo_home(), has_installed_exe("foo_2"));
- assert_that(p.cargo_process("uninstall").arg("foo"),
+ assert_that(p.cargo("uninstall").arg("foo"),
execs().with_status(0));
- assert_that(p.cargo_process("install").arg("--features").arg("c"),
+ assert_that(p.cargo("install").arg("--features").arg("c"),
execs().with_status(0));
assert_that(cargo_home(), has_installed_exe("foo_1"));
assert_that(cargo_home(), has_installed_exe("foo_2"));
- assert_that(p.cargo_process("uninstall").arg("foo"),
+ assert_that(p.cargo("uninstall").arg("foo"),
execs().with_status(0));
- assert_that(p.cargo_process("install").arg("--no-default-features"),
+ assert_that(p.cargo("install").arg("--no-default-features"),
execs().with_status(101).with_stderr("\
[INSTALLING] foo v0.0.1 ([..])
[FINISHED] release [optimized] target(s) in [..]